#{extends 'main.html' /}
#{set title:'Schedule' /}


<div class="series_title">Schedule</div>

<div class="clear" style="height:20px"></div>

<div class="schedule_type">
#{if user}
<a href="/schedule">All Shows</a> / My Shows
#{/if}
#{else}
All Shows / <a href="/schedule/${userId}">My Shows</a>
#{/else}
</div>

<div class="clear" style="height:20px"></div>


#{form @Schedule.index(user?.id)}

<div class="schedule_datepicker">
Date 
<label for="from">From:</label>
<input type="text" id="from" name="from" class="schedule_form" #{if from}value="${from}"#{/if}/>
<label for="to">To:</label>
<input type="text" id="to" name="to" class="schedule_form" #{if to}value="${to}"#{/if} />
<input type="submit" value="Show" class="schedule_form" style="width: 50px;" />
</div>
#{/form}

#{if episodes.size() > 0}

#{list items:episodes, as:'eps'}
<div class="clear" style="height:20px"></div>
<div class="schedule_date">
<fieldset>
<legend>${eps?.get(0)?.getFormattedDate()}</legend>

<div class="schedule_ep" style="font-weight: bold; height: 20px; text-decoration: underline;">
<div class="schedule_sname" style="font-weight: bold; height: 20px; text-decoration: underline;">Series</div>
<div class="schedule_channel" style="font-weight: bold; height: 20px; text-decoration: underline;">TV Channel</div>
<div class="schedule_title" style="font-weight: bold; height: 20px; text-decoration: underline;">Episode</div>
<div class="schedule_time" style="font-weight: bold; height: 20px; text-decoration: underline;">Time</div>
</div>

#{list items:eps, as:'episode'}
<div class="schedule_ep">
<div class="schedule_sname"><a href="/s/${episode?.serie?.id}">${episode?.serie?.name}</a></div>
<div class="schedule_channel">${episode?.serie?.channel}</div>
<div class="schedule_title"><a href="/s/${episode?.serie?.id}/episodes/${episode?.id}">(${episode?.season}x${episode?.episode})<br />${episode?.title}</a></div>
<div class="schedule_time">${episode?.serie?.getFormattedAirTime()}<br /><span style="font-size:11px">${episode?.serie?.timezone}</span></div>
</div>
#{/list}

</fieldset>
</div>
#{/list}

#{/if}